#include <allegro.h>
#include <stdlib.h>
#include <unistd.h>
#include "chargement.h"
#include "collision.h"
#include "affichage.h"
void chargement_image(perso *p,ennem *e, bon *b,cartouche *c,vie *v ,background *bg ,fleche *f)
{

    p->img_left[0]=load_bitmap("left0.bmp",0);
    p->img_left[1]=load_bitmap("left1.bmp",0);
	p->img_left[2]=load_bitmap("left2.bmp",0);

	p->img_right[0]=load_bitmap("right0.bmp",0);
    p->img_right[1]=load_bitmap("right1.bmp",0);
	p->img_right[2]=load_bitmap("right2.bmp",0);

	p->jumpr=load_bitmap("jumpr.bmp",0);
	p->jumpl=load_bitmap("jumpl.bmp",0);

	 p->img_attack_r=load_bitmap("attack_R.bmp",0);
    p->img_attack_l=load_bitmap("attack_L.bmp",0);

     p->flecher=load_bitmap("perso_flecher.bmp",0);
    p->flechel=load_bitmap("perso_flechel.bmp",0);

    p->sans_flechel=load_bitmap("perso_sans_flechel.bmp",0);
    p->sans_flecher=load_bitmap("perso_sans_flecher.bmp",0);

    e->img_left[0]=load_bitmap("eleft0.bmp",0);
    e->img_left[1]=load_bitmap("eleft1.bmp",0);
	e->img_left[2]=load_bitmap("eleft2.bmp",0);

	e->img_right[0]=load_bitmap("eright0.bmp",0);
    e->img_right[1]=load_bitmap("eright1.bmp",0);
	e->img_right[2]=load_bitmap("eright2.bmp",0);

    b->img_bonus=load_bitmap("bonus.bmp",0);



    c->img_cart=load_bitmap("cart.bmp",0);


    v->img_vie[0]=load_bitmap("vie0.bmp",0) ;
    v->img_vie[1]=load_bitmap("vie1.bmp",0) ;
    v->img_vie[2]=load_bitmap("vie2.bmp",0) ;
    v->img_vie[3]=load_bitmap("vie3.bmp",0) ;
    v->img_vie[4]=load_bitmap("vie4.bmp",0) ;
    v->img_vie[5]=load_bitmap("vie5.bmp",0) ;
    v->img_vie[6]=load_bitmap("vie6.bmp",0) ;
    v->img_vie[7]=load_bitmap("vie7.bmp",0) ;
    v->img_vie[8]=load_bitmap("vie8.bmp",0) ;
    v->img_vie[9]=load_bitmap("vie9.bmp",0) ;
    v->img_vie[10]=load_bitmap("vie10.bmp",0);

    v->img_puiss[0]=load_bitmap("puiss0.bmp",0) ;
    v->img_puiss[1]=load_bitmap("puiss1.bmp",0) ;
    v->img_puiss[2]=load_bitmap("puiss2.bmp",0) ;
    v->img_puiss[3]=load_bitmap("puiss3.bmp",0) ;
    v->img_puiss[4]=load_bitmap("puiss4.bmp",0) ;


    bg->background=load_bitmap("background.bmp",0);
    bg->backgroundcol=load_bitmap("background_collision.bmp",0);
    bg->back_ground=load_bitmap("back-ground.bmp",0);

    f->img_f[0]=load_bitmap("0.bmp",0);
    f->img_f[1]=load_bitmap("1.bmp",0);
    f->img_f[2]=load_bitmap("2.bmp",0);
    f->img_f[3]=load_bitmap("3.bmp",0);
    f->img_f[4]=load_bitmap("4.bmp",0);
    f->img_f[5]=load_bitmap("5.bmp",0);
    f->img_f[6]=load_bitmap("6.bmp",0);

    f->img_fl[0]=load_bitmap("l0.bmp",0);
    f->img_fl[1]=load_bitmap("l1.bmp",0);
    f->img_fl[2]=load_bitmap("l2.bmp",0);
    f->img_fl[3]=load_bitmap("l3.bmp",0);
    f->img_fl[4]=load_bitmap("l4.bmp",0);
    f->img_fl[5]=load_bitmap("l5.bmp",0);
    f->img_fl[6]=load_bitmap("l6.bmp",0);
}

void initialisation(perso *p,ennem *e, bon *b,cartouche *c,vie *v ,background *bg ,fleche *f)

{

    p->x= 200;
	p->ix= 200;
	p->y=300 ;
	p->pos=1;
	p->pos_jump=0;

    e->en_vie=1;
	e->x=2800 ;
	e->y=435 ;
	e->pos=-1;
	e->vie=3;

	b->en_vie=1;
    b->x=1000;
	b->y=200;

	c->x=0;
	c->y=0;
    c->xx=0;
    c->xxx=0;
    c->te=1;
    c->boad=0;
    c->carr=0;

	v->pourcentage=9;
	v->nombre_de_puissance=0 ;
	v->nobmre_de_vie =10;

    bg->bh=0 ;
    bg->by=-100 ;


    f->en_vie=0;
    f->dem=0;
    f->p=0;
    f->py=0;
    f->x=p->x;
    f->x=p->y;
}


